;;
;(watch all)

;(get-current-module)

;(defmodule CREATE_PROPOSAL)
;(set-current-module CREATE_PROPOSAL)

;(get-current-module)

;(reset)

;(run)
;;

(reset)

(assert (MAIN::mortgage-payment 2000))

(defmodule WORK)

(deftemplate job (slot salary))

(defmodule HOME)

(deftemplate hobby (slot name) (slot income))

(defrule WORK::quit-job
  (job (salary ?s))
  (HOME::hobby (income ?i&:(> ?i (/ ?s 2))))
  (mortgage-payment ?m&:(< ?m ?i))
  =>
  (call-boss)
  (quit-job))


(ppdefrule WORK::quit-job)
"(defrule WORK::quit-job
   (job (salary ?s))
   (HOME::hobby (income ?i&:(> ?i (/ ?s 2))))
   (MAIN::mortgage-payment ?m&:(< ?m ?i))
   =>
   (call-boss)
   (quit-job))"

(run)